local skel = fk.CreateSkill {
  name = "efengqi__benghuai",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["efengqi__benghuai"] = "崩坏",
  [":efengqi__benghuai"] = "锁定技，结束阶段，若你不是体力值最小的角色，你选择：1.减1点体力上限；2.失去1点体力。",

  ["$efengqi__benghuai1"] = "我是不是该减肥了？",
  ["$efengqi__benghuai2"] = "呃……",
}

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Finish and
      table.find(player.room.alive_players, function(p) return p.hp < player.hp end)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local choice = room:askToChoice(player, { choices = {"loseMaxHp", "loseHp"}, skill_name = self.name})
    if choice == "loseMaxHp" then
      room:changeMaxHp(player, -1)
    else
      room:loseHp(player, 1, self.name)
    end
  end,
})

return skel
